Skip to content

fix(fqdn): enforce maximum DNS name length - #1603

Merged
nodivbyzero merged 1 commit into
go-playground:masterfrom
matheusgb:fix/fqdn-max-length
Jul 29, 2026
Merged

fix(fqdn): enforce maximum DNS name length#1603
nodivbyzero merged 1 commit into
go-playground:masterfrom
matheusgb:fix/fqdn-max-length

Conversation

@matheusgb

Copy link
Copy Markdown
Contributor

Fixes Or Enhances

Fixes #1602.

The fqdn validator limited each individual label to 63 characters but did not enforce the 255-octet DNS wire-format limit for the complete name. As a result, syntactically valid labels could be repeated until the resulting domain exceeded the maximum DNS name length.

This change rejects FQDNs whose presentation form exceeds 253 characters, excluding the optional trailing root dot. It preserves support for a 254-character absolute FQDN when the final character is the root dot.

Boundary tests cover valid and invalid names both with and without the trailing dot.

Validation performed:

go test ./... -count=1

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

@matheusgb
matheusgb marked this pull request as ready for review July 21, 2026 19:03
@matheusgb
matheusgb requested a review from a team as a code owner July 21, 2026 19:03
@nodivbyzero
nodivbyzero merged commit 67e37d6 into go-playground:master Jul 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: fqdn validator does not enforce the maximum DNS name length

3 participants